/*
*	(*^。^*) TFrameWork License (*^。^*)
*/

/*
 *  Title :  
 *          
 *  Description :  
 *          
 *          
 *  Date : 
 *
 *  Author : DengPing
 *
 *  Modify : 
 */

using UnityEditor;
using UnityEngine;

namespace TFrameWork.Module.ActionEditor
{

    internal partial class ActionEditor
    {

        private ActionEditorConfig _actionEditorConfig;

        private void InitConfig()
        {
            var path = ActionEditorUtility.GetAssetPath("t:guiskin", "ActionEditorConfig.guiskin");
            path = path.Replace("ActionEditorConfig.guiskin", "");

            var data = AssetDatabase.LoadAssetAtPath<ActionEditorConfig>(path + "ActionEditorConfig.asset");

            if (data == null)
            {
                ActionEditorConfig config = ScriptableObject.CreateInstance<ActionEditorConfig>();
                _actionEditorConfig = config;
                AssetDatabase.CreateAsset(_actionEditorConfig, path + nameof(ActionEditorConfig)+".asset");
                AssetDatabase.SaveAssets();
                AssetDatabase.Refresh();
            }
            else
            {
                _actionEditorConfig = data;
            }
        }
        
        public ActionEditorConfig actionEditorConfig
        {
            get => _actionEditorConfig;
        }
    }
}
